package yunquan.wang.modules.customer.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import yunquan.wang.base.domain.AuditableEntity;
@Entity
@Table(name = "c_customer")
public class Customer extends AuditableEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 6286881032638885980L;

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "company_id")
	private Company company;
	
	 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	Set<Contacts> contactsSet=new HashSet<Contacts>();
	 @Column(name="level",length=1)
	private Integer level;
	
		/*
		 * 0.公司企业，1，个人，2，党政机关，3，其它团体
		 */
	 @Column(name="type",length=1)
		private Integer type;//
		
	 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customer")
	 private Set<BusinessRecord> businessRecords=new HashSet<BusinessRecord>();
		public Customer()
		{
			
		}
		
		public Customer(String companyFullName,Integer type)
		{
			super();
			this.type = type;
			company=new Company();
			company.setFullName(companyFullName);
		}
	public Customer(Integer level, Integer type) {
		super();
		this.level = level;
		this.type = type;
	}

	public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}
	public Set<Contacts> getContactsSet() {
		return contactsSet;
	}
	public void setContactsSet(Set<Contacts> contactsSet) {
		this.contactsSet = contactsSet;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	public Set<BusinessRecord> getBusinessRecords() {
		return businessRecords;
	}
	public void setBusinessRecords(Set<BusinessRecord> businessRecords) {
		this.businessRecords = businessRecords;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	
	
}
